

package com.zkmonitor.common;

import com.zkmonitor.model.User;

import org.springframework.stereotype.Service;

@Service
public class UserHolderImpl implements UserHolder {

    private ThreadLocal<User> contextHolder = new ThreadLocal<User>();

    @Override
    public User getUser() {
        return contextHolder.get();
    }

    @Override
    public void setUser(User user) {
        contextHolder.set(user);
    }

    @Override
    public void clean() {
        contextHolder.remove();
    }

}
